package club.kingyin.kyblogprouser.dao;

import club.kingyin.commons.entity.user.Friend;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import club.kingyin.commons.entity.user.User;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.conditions.Wrapper;

/**
 * (User)表数据库访问层
 *
 * @author makejava
 * @since 2022-01-20 15:04:02
 */
public interface UserDao extends BaseMapper<User> {

    @Select("select user.id,user.avater,user.slogan,user.sex,user.nickname,friend.status status from user join friend on user.id = friend.friendId ${ew.customSqlSegment}")
    Page<User> getFriends(Page<User>page, @Param(Constants.WRAPPER) Wrapper<Friend> queryWrapper);
}

